home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / Math Visin v2.1 disk 1.adf / Arexx.WB / Contour / PatchWork < prev    next >
Text File  |  1992-02-12  |  6KB  |  203 lines

  1. /* PatchWork   allow creation of posters with MathVision 12-Feb-90 dh
  2.  
  3.   This program lets you make posters with MathVision, by plotting a big
  4. picture in segments, which you can print out and tape together.
  5.  
  6.   To use this program, load MathVision with the picture you want to blow up. 
  7. It is a good idea to have this picture saved on disk for future reference.
  8.  
  9. +---+---+---+    Units per Side determines how big your poster will be.
  10. |1,1|2,1|3,1|  For example, with three units per side, it will contain
  11. +---+---+---+  3 * 3 screens, or 9.
  12. |1,2|2,2|3,2|
  13. +---+---+---+    Overlap determines how much extra is printed on the sides
  14. |1,3|3,2|3,3|  to simplify the trimming and matching processes.  Since the
  15. +---+---+---+  segments are printed in vertical strips, it is useful to 
  16.                have no overlap on the Y axis if your printer prints
  17. successive screens with no gaps between.
  18.  
  19.   There are two basic ways to use this program.  You can Print while 
  20. Plotting, which is a quick and dirty way to test your setup.  Or, you 
  21. can have the pictures saved on disk, to be printed later with the Print
  22. from Disk option.
  23.  
  24.   If you could not complete the calculations in one session, you may change
  25. the starting coordinates.  Load the original picture, and give the next 
  26. frame to compute, as shown in the above diagram.
  27.  
  28. TIPS FOR PRINTING:
  29. - If you are using a dot-matrix printer, use the tractor feed if possible.
  30. This gives much more accurate registration when printing long vertical
  31. strips.
  32.  
  33. ============================================================================ */
  34.  
  35. ADDRESS "MathVision"
  36. OPTIONS RESULTS
  37. NUMERIC DIGITS 14
  38. OPTIONS FAILAT 1
  39. SIGNAL ON ERROR
  40.  
  41. ClrScr = D2C(12)
  42. StopSign "F"
  43.  
  44. Action = "T"
  45.  
  46. Patches = 2
  47. XOverlap = 2
  48. YOverlap = 0
  49. BaseFileName = "Patches:Pic"
  50.  
  51. DO WHILE command ~= "X"
  52.   command = MENU()
  53.  
  54.   SELECT
  55.     WHEN command ='P' THEN
  56.       DO
  57.         CALL Generate_Pictures('P')
  58.       END
  59.     WHEN command ='D' THEN
  60.       DO
  61.         CALL Generate_Pictures('D')
  62.       END
  63.     WHEN command ='S' THEN
  64.       DO
  65.         CALL Generate_Pictures('S')
  66.       END
  67.     WHEN command ='O' THEN
  68.       DO
  69.         Xoverlap = GetAns("Percent Overlap on X Axis",XOverlap )
  70.         Yoverlap = GetAns("Percent Overlap on Y Axis",YOverlap )
  71.       END
  72.     WHEN command ='F' THEN
  73.       DO
  74.         BaseFilename = GetAns("Base Filename", BaseFilename )
  75.       END
  76.     WHEN command ='U' THEN
  77.       DO
  78.         Patches = GetAns("Units on a Side", Patches )
  79.         if (Patches<2) THEN Patches = 2
  80.       END
  81.     OTHERWISE say command;
  82.   END /*select*/
  83. END
  84.  
  85. EXIT
  86.  
  87. /*================================== MENU ================================= */
  88.  
  89. MENU:
  90.   SAY ClrScr
  91.   SAY "U - Units per side   ("Patches", Total: "patches*patches")"
  92.   SAY "O - Overlap Percent  (X "Xoverlap"%    Y "Yoverlap"%)"
  93.   SAY "F - Filename         ("BaseFileName")"
  94.   SAY "P --  Print while Plotting"
  95.   SAY "S --  Save to Disk while Plotting"
  96.   SAY "D --  Print from Disk"
  97.   SAY "X - Exit"
  98.   SAY ""
  99.   OPTIONS PROMPT "--------------> "
  100.   PULL Command
  101.  
  102.   RETURN command
  103.  
  104. /*------------------------------- Generate_Pictures ------------------------ */
  105. Generate_pictures:
  106.  
  107. Arg Action 
  108.  
  109. StartX = GetAns("Starting X Coordinate",1)-1
  110. StartY = GetAns("Starting Y Coordinate",1)-1
  111.  
  112. Get XMin; LeftX   = RESULT
  113. Get XMax; RightX  = RESULT
  114. Get YMin; BottomY = RESULT
  115. Get YMax; TopY    = RESULT
  116.  
  117. Xspan = (RightX-LeftX)/Patches
  118. Yspan = (TopY-BottomY)/Patches
  119. divr = Patches-1
  120. Stopit = "F"
  121. ReachedStart = "F"
  122.  
  123. DO across = 0 to divr
  124.   DO down = 0 to divr
  125.     IF ((ReachedStart = "F") & ((StartX=Across)&(StartY=Down))) THEN ReachedStart = "T";
  126.     IF (ReachedStart = "T")
  127.     THEN
  128.       DO
  129.         XMin LeftX+ (across  )*XSpan - XOverlap/100*XSpan
  130.         XMax LeftX+ (across+1)*XSpan + XOverlap/100*XSpan
  131.         YMax TopY - (down    )*YSpan + YOverlap/100*YSpan
  132.         YMin TopY - (down+1  )*YSpan - YOverlap/100*YSpan
  133.  
  134.         Filename = BaseFileName||".X"Right(across+1,2,"0")".Y"Right(down+1,2,"0")
  135.  
  136.         SAY "X"Across+1" Y"Down+1
  137.  
  138.         SELECT
  139.           WHEN Action = "P" THEN
  140.             DO
  141.               PlotContour
  142.               if Stopit() THEN BREAK;
  143.               PrintScreen
  144.             END
  145.           WHEN Action = "S" THEN
  146.             DO
  147.               PlotContour
  148.               if Stopit() THEN BREAK;
  149.               Pathname Filename
  150.               SavePicture
  151.             END
  152.           WHEN Action = "D" THEN
  153.             DO
  154.               Pathname Filename
  155.               LoadPicture
  156.               PrintScreen
  157.             END
  158.         END
  159.         if Stopit() THEN BREAK;
  160.     END
  161.   END
  162.   if Stopit() THEN BREAK;
  163. END 
  164.  
  165. StopSign "F"   /* reset to normalcy */
  166.  
  167. XMin LeftX
  168. XMax RightX
  169. YMin BottomY
  170. YMax TopY
  171.  
  172. RETURN 
  173.  
  174. /* --------------------------------- GetAns -------------------------------- */
  175. /* result = GetAns( prompt, default) */
  176. /* prompt for input, displaying default. Accept one item. If only <return> */
  177. /* was pressed, return the default answer */
  178.  
  179. GetAns:
  180.   parse arg prompter, default
  181.   Options Prompt Prompter "(" Default "): "
  182.   pull response
  183.   if (response = "") THEN response = default
  184.   return(response)
  185.  
  186. /*------------------------------- StopIt -------------------------------- */
  187. /* Ask MathVision if we should stop, return boolean result */
  188. StopIt:
  189.  
  190.   ret = 0;
  191.   Get StopSign
  192.   if (Result = "T") THEN ret = 1;
  193.   RETURN(ret);
  194.  
  195. /*-------------------------------- ERROR -------------------------------- */
  196.  
  197. ERROR:         /* Error Diagnostic for return codes */
  198.   Get Diagnosis RC
  199.   SAY RESULT" on line "SIGL
  200.   DO i = 1 to 5000
  201.   END
  202.   EXIT
  203.